<?php


namespace app\xiangji\controller;


use app\Request;
use app\xiangji\BaseController;
use app\xiangji\services\UserRechargeService;
use think\App;

class Pay extends BaseController
{
    private $rechargeService;

    public function __construct(UserRechargeService $rechargeService)
    {
        $this->rechargeService = $rechargeService;
    }

    /**
     * @todo 小程序支付
     * @param Request $request
     * @return \think\response\Json
     */
    public function miniprogram(Request $request)
    {
        $result = $this->rechargeService->miniprogram($request);
        return $this->success($result);
    }

    public function queryPayStatus(Request $request)
    {
        $result = $this->rechargeService->queryPayStatus($request->get('order_no'));
        return $this->success($result);
    }

    public function wxPayNotify()
    {
        return $this->rechargeService->wxPayNotify()->send();
    }
}
